{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "c432c663-5ffd-40ed-9ff9-0eb72186c9ca",
   "metadata": {},
   "source": [
    "# 👋🌍 Hello, world: Submit a Q# job to Quantinuum\n",
    "\n",
    "In this notebook, we'll review the basics of Azure Quantum by submitting a simple *job*, or quantum program, to [Quantinuum](https://www.quantinuum.com/). We will use [Q#](https://docs.microsoft.com/azure/quantum/user-guide/) to express the quantum job."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7be286dc-1374-4569-a508-3efbbf75e51a",
   "metadata": {
    "nteract": {
     "transient": {
      "deleting": false
     }
    }
   },
   "source": [
    "## Submit a simple job Quantinuum using Azure Quantum\n",
    "Azure Quantum provides several ways to express quantum programs. In this example we are using Q#, but note that Qiskit and Cirq are also supported. All code in this example will be written in Python and Q#.\n",
    "\n",
    "Let's begin. When you see a code block, hover over it and click the triangle play-button to execute it. To avoid any compilation issues, this should be done in order from top to bottom."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "522c7ee8-e12b-47af-b5c1-47a82d8fe4dd",
   "metadata": {
    "nteract": {
     "transient": {
      "deleting": false
     }
    }
   },
   "source": [
    "### 1. Connect to the Azure Quantum workspace\n",
    "\n",
    "To connect to the Azure Quantum service, call the `connect` function as seen below. This can take 30 seconds to run the first time, as the Q# environment is initializing."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "9b6f3b87-3b98-486a-85b5-36280e20ab21",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Preparing Q# environment...\n",
      "."
     ]
    },
    {
     "data": {
      "application/x-qsharp-data": "\"Connecting to Azure Quantum...\"",
      "text/plain": [
       "Connecting to Azure Quantum..."
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Authenticated using Microsoft.Azure.Quantum.Authentication.TokenFileCredential\n",
      "\n",
      "\n",
      "Connected to Azure Quantum workspace megan-aq-workspace in location eastus.\n"
     ]
    }
   ],
   "source": [
    "import qsharp.azure\n",
    "targets = qsharp.azure.connect(\n",
    "   resourceId=\"\",\n",
    "   location=\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1260a8ea-8825-470f-90bd-d8fe0d758e6e",
   "metadata": {
    "nteract": {
     "transient": {
      "deleting": false
     }
    }
   },
   "source": [
    "We can use the resulting object to see which _targets_ are available for submission."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "0d142ad8-32f6-4936-8974-78955376e9d0",
   "metadata": {
    "jupyter": {
     "outputs_hidden": false,
     "source_hidden": false
    },
    "nteract": {
     "transient": {
      "deleting": false
     }
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "This workspace's targets:\n",
      "- ionq.qpu\n",
      "- ionq.simulator\n",
      "- quantinuum.qpu.h1-1\n",
      "- quantinuum.sim.h1-1sc\n",
      "- quantinuum.sim.h1-1e\n",
      "- quantinuum.qpu.h1\n"
     ]
    }
   ],
   "source": [
    "import qsharp\n",
    "\n",
    "print(\"This workspace's targets:\")\n",
    "for target in targets:\n",
    "    print(\"-\", target.id)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b95ef02e-5fd4-4ac1-9a8b-73eb2648b471",
   "metadata": {
    "nteract": {
     "transient": {
      "deleting": false
     }
    }
   },
   "source": [
    "### ❕ Do you see `quantinuum.sim.h1-1sc` in your list of targets? If so, you're ready to keep going.\n",
    "\n",
    "Don't see it? You may need to add Quantinuum to your workspace to run this sample. Navigate to the **Providers** page in the portal and click **+Add** to add the Quantinuum provider. Don't worry, there's a free credits plan available.\n",
    "\n",
    "### ❕ Do you see `quantinuum.sim.h1-1sc` in your list of targets? If so, you're ready to keep going.\n",
    "\n",
    "Don't see it? You may need to add Quantinuum to your workspace to run this sample. Navigate to the **Providers** page in the portal and click **+Add** to add the Quantinuum provider. Don't worry, there's a free credits plan available.\n",
    "\n",
    "## Quantinuum: The quantum provider\n",
    "Azure Quantum partners with third-party companies to deliver solutions to quantum jobs. These company offerings are called *providers*. Each provider can offer multiple *targets* with different capabilities. See the table below for Quantinuum's H1-1 device targets.\n",
    "\n",
    "| Target name | Target ID | Number of qubits | Description|\n",
    "| --- | ---| ---|---|\n",
    "H1-1 Syntax Checker | `quantinuum.sim.h1-1sc` | 20 | Quantinuum's H1-1 Syntax Checker. This will return all zeros in place of actual or simulated results. Use this to validate quantum programs against the H1-1 compiler before submitting to hardware or emulators on Quantinuum's platform. Free of cost. |\n",
    "H2-1 Syntax Checker | `quantinuum.sim.h2-1sc` | 32 | Quantinuum's H2-1 Syntax Checker. This will return all zeros in place of actual or simulated results. Use this to validate quantum programs against the H2-1 compiler before submitting to hardware or emulators on Quantinuum's platform. Free of cost.  |\n",
    "H1-1 Emulator | `quantinuum.sim.h1-1e` | 20 | Quantinuum's H1-1 Emulator. Uses a realistic physical model and noise model of H1-1. |\n",
    "H2-1 Emulator | `quantinuum.sim.h2-1e` | 32 | Quantinuum's H2-1 Emulator. Uses a realistic physical model and noise model of H2-1. |\n",
    "H1-1 | `quantinuum.qpu.h1-1` | 20 | Quantinuum's H1-1 trapped ion device. |\n",
    "H2-1 | `quantinuum.qpu.h2-1` | 32 | Quantinuum's H2-1 trapped ion device. |\n",
    "\n",
    "For this example, we will use `quantinuum.sim.h1-1sc` to avoid any costs or credit usage. If you wish to emulate or run the actual circuit, you may replace all instances of `quantinuum.sim.h1-1sc` in subsequent code cells with one of the other values in the table above, but please note any costs incurred. To learn more about Quantinuum's targets, check out our [documentation](https://aka.ms/AQ/Quantinuum/Documentation)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "86c78860-1c39-4a3c-afb8-0314174d20f3",
   "metadata": {},
   "source": [
    "### 2. Build the quantum program\n",
    "\n",
    "Let's create a simple Q# program to run. This can take 30 seconds to run the first time, as the Q# environment is initializing."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "3cce2bae-4a8a-47b6-b446-e06fd8cd0206",
   "metadata": {
    "jupyter": {
     "outputs_hidden": false,
     "source_hidden": false
    },
    "nteract": {
     "transient": {
      "deleting": false
     }
    }
   },
   "outputs": [],
   "source": [
    "# We declare the function we will define in Q# as a callable so that Python recognizes the symbol.\n",
    "GenerateRandomBit: any = None"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "1dcc9067-3d22-4370-a24b-3220bf25ed02",
   "metadata": {
    "microsoft": {
     "language": "qsharp"
    }
   },
   "outputs": [],
   "source": [
    "%%qsharp\n",
    "open Microsoft.Quantum.Measurement;\n",
    "open Microsoft.Quantum.Arrays;\n",
    "open Microsoft.Quantum.Convert;\n",
    "\n",
    "operation GenerateRandomBit() : Result {\n",
    "    use target = Qubit();\n",
    "\n",
    "    // Apply an H-gate and measure.\n",
    "    H(target);\n",
    "    return M(target);\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e2846412-7fe7-4970-a4ad-343a209f6e56",
   "metadata": {
    "nteract": {
     "transient": {
      "deleting": false
     }
    }
   },
   "source": [
    "The program you built is a simple quantum random bit generator. With Quantinuum's Syntax Checker, we will be able to confirm that the circuit is able to be run on their H1 emulator and hardware."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "59ba947d-dfdc-48a3-853c-432edce70d95",
   "metadata": {},
   "source": [
    "### 3. Submit the quantum program to Quantinuum\n",
    "\n",
    "We will use the `execute` function to run the quantum program above on Quantinuum's `quantinuum.sim.h1-1sc` target. This may take a minute or so ⏳. Your job will be packaged and sent to Quantinuum, where it will wait its turn to be run."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "c9d1ddbb-bbee-4681-8b85-7e188d1e2a50",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading package Microsoft.Quantum.Providers.Honeywell and dependencies...\n",
      "Active target is now quantinuum.sim.h1-1sc\n",
      "Submitting GenerateRandomBit to target quantinuum.sim.h1-1sc...\n",
      "Job successfully submitted.\n",
      "   Job name: Generate one random bit\n",
      "   Job ID: 6d088975-5539-4585-b114-8e6ef44ac6da\n",
      "Waiting up to 240 seconds for Azure Quantum job to complete...\n",
      "[19:11:39] Current job status: Waiting\n",
      "[19:11:44] Current job status: Succeeded\n"
     ]
    }
   ],
   "source": [
    "# Set the target to quantinuum.sim.h1-1sc\n",
    "qsharp.azure.target(\"quantinuum.sim.h1-1sc\")\n",
    "\n",
    "# Execute the job. We'll use 100 shots (simulated runs). Timeout is in seconds.\n",
    "result = qsharp.azure.execute(GenerateRandomBit, shots=100, jobName=\"Generate one random bit\", timeout=240)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "45eaf502-ca04-4fd3-9757-c30a97912010",
   "metadata": {
    "nteract": {
     "transient": {
      "deleting": false
     }
    }
   },
   "source": [
    "The job ID can be used to retrieve the results later using the `output` and `status` functions or by viewing it under the **Job management** section of the portal."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "187a6719-ca0c-4433-a6b1-341d90f6699c",
   "metadata": {
    "nteract": {
     "transient": {
      "deleting": false
     }
    }
   },
   "source": [
    "### 4. Visualize the job results\n",
    "You can view a histogram of the results using [`pyplot`](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.html):\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "88a68c6e-3f08-4719-9c98-dde51619f25b",
   "metadata": {
    "jupyter": {
     "outputs_hidden": false,
     "source_hidden": false
    },
    "nteract": {
     "transient": {
      "deleting": false
     }
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEWCAYAAABrDZDcAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAASzElEQVR4nO3dfdCldV3H8feHXRADQmN3imFZlylo3TQe2sgwczMxVpPNp2ST0oba0REfIpqhMjR0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rvPkas6MnAAAAAElFTkSuQmCC",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from matplotlib import pyplot\n",
    "\n",
    "pyplot.bar(result.keys(), result.values())\n",
    "pyplot.title(\"Result\")\n",
    "pyplot.ylabel(\"Probability\")\n",
    "pyplot.xlabel(\"Measurement\")\n",
    "\n",
    "pyplot.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ea2caa37-271f-438c-983f-4d6d673511b6",
   "metadata": {
    "nteract": {
     "transient": {
      "deleting": false
     }
    }
   },
   "source": [
    "**See the histogram above? Congratulations, you've submitted a job with Azure Quantum! 👏**"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "91cc3611-cec1-4abd-b2cb-5fb6b815687d",
   "metadata": {
    "nteract": {
     "transient": {
      "deleting": false
     }
    }
   },
   "source": [
    "### 5. Next steps\n",
    "Next, you can try running a program on Quantinuum's emulation target - just replace `quantinuum.sim.h1-1sc` with `quantinuum.sim.h1-1e`. Or try another sample by navigating back to the sample gallery. The same \"hello world\" sample can be run with different quantum providers by choosing another option in the gallery card drop-down menu. Don't worry - your work here is automatically saved.\n",
    "\n",
    "To learn more about submitting jobs to Azure Quantum using Q#, refer to [this documentation](https://docs.microsoft.com/azure/quantum/how-to-submit-jobs?pivots=ide-python).\n",
    "\n",
    "To learn more about job pricing, review the [Azure Quantum documentation on job costs](https://docs.microsoft.com/azure/quantum/azure-quantum-job-costs)."
   ]
  }
 ],
 "metadata": {
  "kernel_info": {
   "name": "python3"
  },
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.11"
  },
  "nteract": {
   "version": "nteract-front-end@1.0.0"
  },
  "vscode": {
   "interpreter": {
    "hash": "81794d4967e6c3204c66dcd87b604927b115b27c00565d3d43f05ba2f3a2cb0d"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
